<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.leruan.aasimp.bean.CarBasicCarTypeBean;"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'carBaiscInfoCarType.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="css/newcar.css">

		<script type="text/javascript">
			function carTypeChange(value){
				window.location="newcar/carBasicInfoAction_showCarType?carType=" + value+"&demioType=${request.demioType}";
			}
		function init(){
				var carTypes = document.getElementById('carType').options;
				var carType = "${request.carType}";
				if(carType != ""){
					for(var i=0; i<carTypes.length; i++){
						if(carTypes[i].value == carType){
							document.getElementById('carType').options[i].selected=true;
							break;
						}
					}
				}
			}
		</script>

	</head>

	<body onload="init();">

		<div id="main">
			<div
				style="color: blue; margin-left: 10px; margin-bottom: 10px; font-size: 18px; line-height: 25px;">
				当前车系：&nbsp;${request.carDemioInfo.brand}-${request.carDemioInfo.department
				} &nbsp;&nbsp;&nbsp;&nbsp;车型：&nbsp;&nbsp;
				<select style="font-size: 14px; text-align: center;" id="carType"
					onchange="carTypeChange(this.options[this.options.selectedIndex].value);">
					<option value="0">
						请选择
					</option>
					<s:iterator var='carTypeBean' value="#request.carTypesTotal">
						<option>
							<s:property value="#carTypeBean.carType" />
						</option>
					</s:iterator>
				</select>
				<br />
				<c:if test="${request.dList != null}">
					<Label style="color: gray; font-size: 14px;">
						你可能还感兴趣的车系：
						<s:iterator value="#request.dList" var="demio">
							<c:if test="${demio.demioType != request.carDemioInfo.demioType}">&nbsp;&nbsp;<a
									href="newcar/carBasicInfoAction_showCarType?demioType=${demio.demioType}"
									class="a1"><s:property value="#demio.brand" />-<s:property
										value="#demio.department" /> </a>
							</c:if>
						</s:iterator>
				</c:if>
			</div>
			<table>
				<%
							List<CarBasicCarTypeBean> carTypes = (List<CarBasicCarTypeBean>) request
							.getAttribute("carTypes");
					request.setAttribute("totalSize", carTypes.size());
					for (int i = 0; i < carTypes.size() / 3; i++) {
						request.setAttribute("i", i * 3);
				%>
				<tr style="padding: 10px;">
					<s:iterator var="carTypeBean" value="#request.carTypes"
						begin="#request.i" end="#request.i+2">
						<td style="padding: 5px;">
							<div class="imgDiv" onmouseover="this.style.background='#FFE4D2'"
								onmouseout="this.style.background='#FFF'">
								<a
									href="newcar/carBasicInfoAction_showDetailIndex?id=${carTypeBean.id}"
									rel="nofollow" target="_blank"><img
										src="${carTypeBean.imageAddress}" width="240" height="180" />
								</a>
								<a href="newcar/carBasicInfoAction_showDetailIndex?id=${carTypeBean.id}" class="a" rel="nofollow" target="_blank"><s:property
										value="#carTypeBean.carType" /> </a>
								<br />
								<div class="cinfo_ul" style="text-align: left;">
									<font size="3px" color="black">厂商指导价：</font><span class="price"><s:property
											value="#carTypeBean.directMoney" />万</span>
									<br />
									排量:
									<s:property value="#carTypeBean.dispalcement" />
									L&nbsp;&nbsp;发动机:
									<s:property value="#carTypeBean.engine" />
									<br />
									上市时间:&nbsp;
									<fmt:formatDate value="${carTypeBean.marketTime}"
										pattern="yyyy年MM月" />
								</div>
							</div>
						</td>
					</s:iterator>
				</tr>
				<%
				}
				%>
				<tr style="padding: 10px;">
					<s:iterator var="carTypeBean" value="#request.carTypes"
						begin="#request.i + 3" end="#request.totalSize - 1">
						<td style="padding: 5px;">
							<div class="imgDiv" onmouseover="this.style.background='#FFE4D2'"
								onmouseout="this.style.background='#FFF'">
								<a href="newcar/carBasicInfoAction_showDetailIndex?id=${carTypeBean.id}" rel="nofollow" target="_blank"><img
										src="${carTypeBean.imageAddress}" width="240" height="180" />
								</a>
								<a href="newcar/carBasicInfoAction_showDetailIndex?id=${carTypeBean.id}" class="a" rel="nofollow" target="_blank"><s:property
										value="#carTypeBean.carType" /> </a>
								<br />
								<div class="cinfo_ul" style="text-align: left;">
									<font size="3px" color="black">厂商指导价：</font><span class="price"><s:property
											value="#carTypeBean.directMoney" />万</span>
									<br />
									排量:
									<s:property value="#carTypeBean.dispalcement" />
									L&nbsp;&nbsp;发动机:
									<s:property value="#carTypeBean.engine" />
									<br />
									上市时间:&nbsp;
									<fmt:formatDate value="${carTypeBean.marketTime}"
										pattern="yyyy年MM月" />
								</div>
							</div>
						</td>
					</s:iterator>
				</tr>
			</table>
			<div class="descriptionImg">
				<s:iterator var="url" value="#request.imagesUrl">
					<img src="${url}" />
				</s:iterator>
			</div>
		</div>



	</body>
</html>
